<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body">

        <div class="layui-form-item">
            <label class="layui-form-label">所属模型</label>
            <div class="layui-input-block">
                <select  class="layui-input" name="modelid" required {notempty name='vo.id'}disabled{/notempty}>
                <option value="">请选择模型</option>
                {foreach $models as $key => $model}
                {eq name='model.id' value='$vo.modelid|default=""'}
                <option selected value='{$model.id}'>{$model.name}</option>
                {else}
                <option value='{$model.id}'>{$model.name}</option>
                {/eq}
                {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label label-required-next">所属栏目</label>
            <div class="layui-input-block">
                <select  class="layui-input" name="catid" required>
                    {$categoriesTree|raw}
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">推荐名称</label>
            <div class="layui-input-block">
                <input name="name" value='{$vo.name|default=""}' required placeholder="请输入碎片名称" class="layui-input">
                <p class="help-block">必填，请填写推荐位名称（如：首页新闻推荐），建议字符不要太长，一般4-10个汉字</p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">推荐描述</label>
            <div class="layui-input-block">
                <textarea name="description" id="description" placeholder="请输入推荐位描述" class="layui-textarea">{$vo.description|default=""}</textarea>
            </div>
        </div>

        <div class="hr-line-dashed"></div>
        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
        <div class="layui-form-item text-center">
            <button class="layui-btn" type='submit' lay-filter="saveData">保存数据</button>
            <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
        </div>
    </div>
</form>

{block name='script'}
<script>
    layui.form.render();
</script>
{/block}
